﻿/*==============================================================================
	TASK 4:                                          {Using Classes and Objects}
	Write methods that calculate the surface of a triangle by given:
    Side and an altitude to it; Three sides; Two sides and an angle between them.
    Use System.Math
===============================================================================*/

using System;

namespace _04.SurfaceOfTriangle
{
    class SurfaceOfTriangle
    {
        static void Main()
        {
            Console.WriteLine(surfaceOfTriangleWithAltitude(4, 5));
            Console.WriteLine(surfaceOfTriangleHeron(4, 5, 6));
            Console.WriteLine(surfaceOfTriangleWithAngle(4, 5, 30));
        }

        static double surfaceOfTriangleWithAltitude(double side, double altitude)
        {
            double surface;
            surface = (side * altitude) / 2;
            return surface;
        }
        static double surfaceOfTriangleHeron(double sideOne, double sideTwo, double sideThree)
        {
            double surface;
            double p;

            p=(sideOne + sideTwo +sideThree)/2;
            surface = Math.Sqrt(p * (p - sideOne) * (p - sideTwo) * (p - sideThree));
            return surface;
        }
        static double surfaceOfTriangleWithAngle(double sideOne, double sideTwo, double angleInDegrees)
        {
            double surface;
            double angleInRadians=(Math.PI*angleInDegrees)/180;
            
            surface=(sideOne*sideTwo*Math.Sin(angleInRadians))/2  ;
            return surface;
        }
    }
}
